package com.ruoyi.shop.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.shop.mapper.ShopAddressMapper;
import com.ruoyi.shop.domain.ShopAddress;
import com.ruoyi.shop.service.IShopAddressService;

/**
 * 地址Service业务层处理
 * 
 * @author jiaodacailei
 * @date 2022-06-12
 */
@Service
public class ShopAddressServiceImpl implements IShopAddressService 
{
    @Autowired
    private ShopAddressMapper shopAddressMapper;

    /**
     * 查询地址
     * 
     * @param id 地址主键
     * @return 地址
     */
    @Override
    public ShopAddress selectShopAddressById(Long id)
    {
        return shopAddressMapper.selectShopAddressById(id);
    }

    /**
     * 查询地址列表
     * 
     * @param shopAddress 地址
     * @return 地址
     */
    @Override
    public List<ShopAddress> selectShopAddressList(ShopAddress shopAddress)
    {
        return shopAddressMapper.selectShopAddressList(shopAddress);
    }

    /**
     * 新增地址
     * 
     * @param shopAddress 地址
     * @return 结果
     */
    @Override
    public int insertShopAddress(ShopAddress shopAddress)
    {
        shopAddress.setCreateTime(DateUtils.getNowDate());
        return shopAddressMapper.insertShopAddress(shopAddress);
    }

    /**
     * 修改地址
     * 
     * @param shopAddress 地址
     * @return 结果
     */
    @Override
    public int updateShopAddress(ShopAddress shopAddress)
    {
        shopAddress.setUpdateTime(DateUtils.getNowDate());
        return shopAddressMapper.updateShopAddress(shopAddress);
    }

    /**
     * 批量删除地址
     * 
     * @param ids 需要删除的地址主键
     * @return 结果
     */
    @Override
    public int deleteShopAddressByIds(Long[] ids)
    {
        return shopAddressMapper.deleteShopAddressByIds(ids);
    }

    /**
     * 删除地址信息
     * 
     * @param id 地址主键
     * @return 结果
     */
    @Override
    public int deleteShopAddressById(Long id)
    {
        return shopAddressMapper.deleteShopAddressById(id);
    }
}
